package com.zhiliang.waibao.myapplication;

import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.os.StrictMode;
import com.zhiliang.waibao.myapplication.component.ApplicationComponent;
import com.zhiliang.waibao.myapplication.component.DaggerApplicationComponent;
import com.zhiliang.waibao.myapplication.module.ApplicationModule;
import com.zhiliang.waibao.myapplication.module.HttpModule;
import cn.bingoogolapple.swipebacklayout.BGASwipeBackManager;

/**
 * Created by Administrator on 2018/3/19.
 */
public class MyApp extends Application {
    private ApplicationComponent mApplicationComponent;
    private static MyApp sMyApp;
    static Context sContext;
    @Override
    public void onCreate() {
        super.onCreate();
        sMyApp = this;
        sContext = this;
        BGASwipeBackManager.getInstance().init(this);
        mApplicationComponent = DaggerApplicationComponent.builder()
                .applicationModule(new ApplicationModule(this))
                .httpModule(new HttpModule())
                .build();

        //手机7.0以上拍照
        if (Build.VERSION.SDK_INT > 21) {
            StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
            StrictMode.setVmPolicy(builder.build());
            builder.detectFileUriExposure();
        }
    }

    public static MyApp getInstance() {
        return sMyApp;
    }

    public ApplicationComponent getApplicationComponent() {
        return mApplicationComponent;
    }

    public static Context getsContext() {
        return sContext;
    }
}

